'----------------------------------------------
' Name: Ali Karbassi & Matt Latzke
' Date: March 20, 2007
' Description: Project 4
'              Form frmIndividual
'----------------------------------------------
Public Class frmIndividual

    ''' <summary>
    ''' Loads the table adapter with the database information
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub frmIndividual_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles MyBase.Load

      EmployeeTableAdapter.Connection.ConnectionString = frmAll.connString & frmAll.dblocation
        Me.EmployeeTableAdapter.Fill(Me.ActivityDataSet.Employee)

    End Sub

    ''' <summary>
    ''' Saves the database
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
   Private Sub EmployeeBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As _
   System.EventArgs) Handles EmployeeBindingNavigatorSaveItem.Click

      Me.Validate()
      Me.EmployeeBindingSource.EndEdit()
      Me.EmployeeTableAdapter.Update(Me.ActivityDataSet.Employee)

   End Sub

    ''' <summary>
    ''' Exit's the program
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles btnExit.Click

        Application.Exit()

    End Sub

    ''' <summary>
    ''' Reloads the table
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub btnReload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles btnReload.Click

        Me.EmployeeTableAdapter.Fill(Me.ActivityDataSet.Employee)

    End Sub

    ''' <summary>
    ''' Hides this form, shows the previous form.
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub btnAllEmps_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles btnAllEmps.Click

        Me.Hide()
        frmAll.Show()

    End Sub

   Private Sub DepartmentTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
   Handles DepartmentTextBox.TextChanged

      allErrors.Clear()

      For x As Integer = 0 To DepartmentTextBox.Text.Length - 1

         If Not Char.IsDigit(DepartmentTextBox.Text.Substring(x, 1)) Then

            allErrors.SetError(DepartmentTextBox, "Department must be an integer!")

         End If

      Next

   End Sub

End Class